package com.yn.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum OrganTypeEnum {

    HOSPITAL("1", "医院"),
    REHABILITATION("2", "康复"),
    NURSING_HOME("3", "养老机构");

    private String code;
    private String name;

    public static OrganTypeEnum getByCode(String code) {
        if (code == null) {
            return null;
        }
        for (OrganTypeEnum type : OrganTypeEnum.values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }
}